package com.example.tld;

import java.io.IOException;
import java.util.List;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;

public class ComboboxTLD extends SimpleTagSupport{
	
	private List<String> items;
	
	@Override
	public void doTag() throws JspException, IOException {
		JspWriter writer = getJspContext().getOut();
		writer.print("<select size='1' id='state' class='pure-input-1-2'>");
		if (items == null) {
			writer.print("<option value="+"no string"+">"+"no string"+"</option>");
		} else {
			for (String item : items) {
				writer.print("<option value="+item+">"+item+"</option>");
			}
		}
		writer.print("</select>");
	}

	public List<String> getItems() {
		return items;
	}

	public void setItems(List<String> items) {
		this.items = items;
	}

}
